#include <stdio.h>
#include <stdlib.h>

#include "Model.h"
#include "Decimal.h"
#include "Divide.h"
#include "Expression.h"
#include "Minus.h"
#include "Multiply.h"
#include "Plus.h"
#include "Variable.h"
#include "Pow.h"
#include "Ln.h"
#include "Cos.h"
#include "Sin.h"
#include "Log.h"

void* treeBase;
void* theta;
void* phi;

unsigned int phiStep;
unsigned int thetaStep;

void* getTreeBase()
{
	return treeBase;
}

void setTreeBase(void* base)
{
	treeBase = base;
}

void* createPhi()
{
	phi = new Variable();
}

void* createTheta()
{
	theta = new Variable();
}

void* createDecimal(double value)
{
	return new Decimal(value);
}

void* createPlus(void* left, void* right)
{
	return new Plus((Expression*)left, (Expression*)right);
}

void* createMinus(void* left, void* right)
{
	return new Minus((Expression*)left, (Expression*) right);
}

void* createDivide(void* left, void* right)
{
	return new Divide((Expression*) left, (Expression*) right);
}

void* createMultiply(void* left, void* right)
{
	return new Multiply((Expression*) left, (Expression*) right);
}

void* createPow(void* left, void* right)
{
	return new Pow((Expression*) left, (Expression*) right);
}

void* createLn(void* expression)
{
	return new Ln((Expression*) expression);
}

void* createCos(void* expression)
{
	return new Cos((Expression*) expression);
}

void* createSin(void* expression)
{
	return new Sin((Expression*) expression);
}

void* createLog(void* expression)
{
	return new Log((Expression*) expression);
}

void* getPhi()
{
	return phi != NULL ? phi : new Variable();
}

unsigned int getPhiStep()
{
	return phiStep;
}

void setPhiStep(double stepExpression)
{
	phiStep = (unsigned int) stepExpression;
}

void* getTheta()
{
	return theta != NULL ? theta : new Variable();
}

unsigned int getThetaStep()
{
	return thetaStep;
}

void setThetaStep(double stepExpression)
{
	thetaStep = (unsigned int) stepExpression;
}


